<template>
    <div class="page">
        <div class="page_header" style="display: flex;">
            <div style="flex: 1 1 auto">
                <el-form ref="searchForm" :model="searchForm" style="display: flex;">
                    <el-form-item prop="openid">
                        <el-input v-model="searchForm.openid" placeholder="openid"></el-input>
                    </el-form-item>
                </el-form>
            </div>
            <div style="flex:0 0 auto;">
                <el-button @click="$refs.templateSend.init()" type="primary">发送模板消息</el-button>
                <el-button @click="$store.dispatch('tableReload')" type="primary">查询</el-button>
                <el-button @click="$store.dispatch('tableReset')">重置</el-button>
            </div>
        </div>
        <el-card class="page_body">
            <el-table
                    height="10"
                    class="page_body_table"
                    :data="common.tableData"
                    v-loading="common.loading"
                    border
                    stripe
                    style="width: 100%">
                <el-table-column prop="openid" label="openid"></el-table-column>
                <el-table-column prop="blade" label="推送模板"></el-table-column>
                <el-table-column prop="nickname" label="接收人"></el-table-column>
                <el-table-column prop="name" label="推送人"></el-table-column>
                <el-table-column prop="success_name" label="是否成功"></el-table-column>
                <el-table-column prop="path" label="推送链接"></el-table-column>
                <el-table-column prop="created_at" label="推送时间"></el-table-column>
            </el-table>
            <pagination class="page_body_pagination"></pagination>
        </el-card>
        <template-send-dialog ref="templateSend" @refresh="$store.dispatch('tableReload')"></template-send-dialog>
    </div>
</template>

<script>
    import {mapState} from 'vuex';
    import Pagination from "../Pagination";
    import TemplateSendDialog from "./Dialog/TemplateSendDialog";
    export default {
        name: "Template",
        computed:{
            ...mapState(['common']),
        },
        components:{
            Pagination,
            TemplateSendDialog,
        },
        data(){
            return{
                method:'post',
                url:'/api/setting/template/store',
                searchForm:{
                    openid:'',
                },
            }
        },
        created() {
            this.$store.dispatch('pageInit', this);
        },
        methods:{

        },
    }
</script>

<style scoped>

</style>